package com.dog.basics.security.service;

import cn.hutool.core.util.ObjectUtil;
import lombok.Getter;
import lombok.Setter;
import org.springframework.security.core.userdetails.User;

import java.util.Collections;

/**
 * 用户详细信息
 */
@Getter
public class DogUser extends User {

    /**
     * 用户ID
     */
    private Long userId;

    /**
     * 用户账号
     */
    private String bizUserId;

    /**
     * 首相
     */
    @Setter
    private String pic;

    /**
     * 昵称/名称
     */
    @Setter
    private String name;

    /**
     * 是否未设置密码  TRUE =未设置密码  FALSE=已设置密码
     */
    @Setter
    private boolean setPassword;

    @Setter
    private boolean competitionArea;

    @Setter
    private boolean debugger;

    @Setter
    private Integer flage;
    @Setter
    private Long deptId;

    public DogUser(Long userId, String bizUserId, boolean enabled, String password, Integer flage) {
        super(bizUserId, password, enabled, Boolean.TRUE, Boolean.TRUE, Boolean.TRUE, Collections.emptyList());
        this.userId = userId;
        this.bizUserId = bizUserId;
        this.flage = flage;
        setPassword = (ObjectUtil.isNull(password) || password.equals("-1")) ? Boolean.TRUE : Boolean.FALSE;
    }
}
